<extend name="Shops:layout" />
<block name="content">
<script src="__PUBLIC__/plugins/kindeditor/kindeditor.js"></script>
<script src="__PUBLIC__/plugins/kindeditor/lang/zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/style.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/webuploader.css" />
<script type="text/javascript" src="__PUBLIC__/plugins/webuploader/webuploader.js"></script>
<script type="text/javascript" src="__JS__/goodsbatchupload.js"></script>
<link rel="stylesheet" href="__CSS__/layer.css">
<script type="text/javascript" src="__JS__/layer.js"></script>
<script type="text/javascript" src="__JS__/layer.ext.js"></script>
<script type="text/javascript">
        layer.config({
              extend: 'extend/layer.ext.js'
          });
</script>
       <div class="wst-body"> 
       <div class='wst-page-header'>卖家中心 >编辑中奖用户资料 </div>
       <div class='wst-page-content'>
        <table class="table table-hover table-striped table-bordered wst-form">
              <tr>
               <th width='200'>活动名称：</th>
               <td>
               <input type="text" value="{$data['title']}" AutoComplete="off" name="title" id="title" disabled="true">
               </td>
             </tr>
             <tr>
               <th width='200'>用户名称：</th>
               <td>
               <input type="text" value="{$data['userName']}" AutoComplete="off" name="title" id="title" disabled="true">
               </td>
             </tr>
             <tr>
               <th width='200'>所中奖项：</th>
               <td id="prizenum" value="{$data['prize']}">
               <label id="fist"><input name="prize" type="radio" value="1">一等奖：{$data['jp'][0]}</label>
               <?php if(!empty($data['jp'][1])){
               echo "<label id='second'><input name='prize' type='radio' value='2'>二等奖：".$data['jp'][1]."</label>";
               } ?>
               <?php if(!empty($data['jp'][2])){
               echo "<label id='third'><input name='prize' type='radio' value='3'>三等奖：".$data['jp'][2]."</label>";
               } ?>
               </td>
             </tr>
               <tr>
               <th width='200'>快递公司：</th>
               <td>
               <select name="express" id="express">
                <volist name="data['express']" id='vo'>
                <option id="{$vo['id']}" value="{$vo['id']}">{$vo['expressCompany']}</option>
                </volist>  
               </select>
               </td>
             </tr>
             <tr>
               <th width='200'>快递单号：</th>
               <td>
               <?php if($data['kdnum']!=0){
               $kdnum=$data['kdnum'];
               }else{
               $kdnum='';
               }
                echo "<input type='text' id='kdnum' name='kdnum' value='".$kdnum."'>";
               ?>
               </td>
             </tr>
             <tr>
             <td colspan='2' style='padding:20px 0;text-align:center;'>
                 <button type="button" onclick='javascript:update({$data["id"]});' id="tijiao" class=" wst-btn-query">保&nbsp;存</button>
                 <button type="button" onclick="window.location.href='/Home/ggk/manage/id/{$data["ggkId"]}.html'" class="wst-btn-query">返&nbsp;回</button>
             </td>
           </tr>
        </table>
       </div>
       <div style='clear:both;'></div>
       </div>
        <script type="text/javascript">
         function update(id){
          var prize = $('input[name="prize"]:checked').val();
          var kdnum = $('#kdnum').val();
          var express = $('#express').val();
          $.ajax({
            url:"/Home/Ggk/update.html",
            data:{
              id:id,
              prize:prize,
              kdnum:kdnum,
              expressId:express,
              xg:'x'
            },
            beforesend:function(){
              layer.load();
            },
            success:function(data){
              layer.closeAll();
              if (data.status==1) {
                layer.msg('保存成功', {
                  icon: 1,
                  skin: 'layer-ext-moon' 
                });
                window.location.href="/Home/ggk/manage?id={$data['ggkId']}.html";
              }else{
                layer.msg('出现异常，请稍后再试', {
                  icon: 2,
                  skin: 'layer-ext-moon' 
                });
              }
            }
          });
         }
       </script>
       <script type="text/javascript">
       $(function(){
          var prize = $("#prizenum").attr('value');
          switch(prize){
            case '1':
            $('#fist input').attr('checked','checked');
            break;
            case '2':
            $('#second input').attr('checked','checked');
            break;
            case '3':
            $('#third input').attr('checked','checked');
            break;
          }
          $('#{$data["expressId"]}').attr('selected','selected');
       })
       </script>
      
</block>  